package com.ddx.common.enums;

/**
 * 产品期限类型
 */
public enum ProductTermType {
     // 1:天、2:月、3:年',
    TERM_DAY(1,"天",1),
    TEAM_MONTH(2,"月",30),
    TEAM_YEAR(3,"年",365);

    private Integer code;
    private String msg;
    private Integer days; //转为天数

    ProductTermType(Integer code, String msg , Integer days) {
        this.code=code;
        this.msg=msg;
        this.days = days;
    }

    public Integer getDays() {
        return days;
    }

    public void setDays(Integer days) {
        this.days = days;
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public static ProductTermType getProductTermType(Integer code) {
        for (ProductTermType t : ProductTermType.values()) {
            if (code.equals(t.getCode())) {
                return t;
            }
        }
        return null;
    }
}
